<?php
namespace app\index\controller;
use think\Controller;
use think\Db;

class Index extends Controller
{
    public function index()
    {
        $copy = '<div class="copy">制作人：ζั͡ ั͡怼 ั͡烎 ั͡✾<a href="http://wpa.qq.com/msgrd?v=3&uin=1395961821&site=qq&menu=yes" target="_blank"><img src="__STATIC__/img/qq.png" width="20px" height="20px"></a></div>';
        return view('index',['copy'=>$copy]);
    }
    public function begin_end()
    {
    	$article = input('post.article');
    	$res = Db::table('student')->where('stuId',$article)->select();
		$json_data=json_encode($res);
    	echo $json_data;
    }

    public function sel_stu()
    {
        $res = Db::table('student')->select();
        $arr_data = array();
        for ($i=0; $i <count($res) ; $i++) { 
            $arr_data[$i] = $res[$i]['stuId']; 
        }
        $json_data = json_encode($arr_data);
        echo $json_data;
    }

    public function batch_sel()
    {
        $arr_data=array();
        $post_arr_data = input('post.rand_data/a');
        for ($i=0; $i < count($post_arr_data); $i++) { 
          $arr_data[$i] = $post_arr_data[$i];
        }
        $str_data = implode(',',$arr_data);
        $res = Db::table('student')->where('stuId in ('.$str_data.')')->select();
        shuffle($res);
        $json_data = json_encode($res);
        echo $json_data;
    }

}
